import { service } from '@/utils/request'

const api = {
  getCouponList: '/admin/promotion/customerCoupon/list',
  freezeStatus: 'admin/promotion/customerCoupon/frozen',
  updateCouponSubmit: 'admin/promotion/customerCoupon/updateCoupon',
  getHistoryData: 'admin/promotion/customerCoupon/update_record_list',
  getAddCouponData: 'admin/promotion/couponMaster/pageList',
  onFillCoupon: 'admin/promotion/customerCoupon/fillCoupon'
}

export function getCouponList (data) {
  return service({
    url: api.getCouponList,
    method: 'post',
    data
  })
}

export function freezeStatus (data) {
  return service({
    url: api.freezeStatus,
    method: 'post',
    data
  })
}

export function updateCouponSubmit (data) {
  return service({
    url: api.updateCouponSubmit,
    method: 'post',
    data
  })
}

export function getAddCouponData (data) {
  return service({
    url: api.getAddCouponData,
    method: 'post',
    data
  })
}

export function onFillCoupon (data) {
  return service({
    url: api.onFillCoupon,
    method: 'post',
    data
  })
}

export function getHistoryData (id) {
  return service({
    url: api.getHistoryData + `/${id}`,
    method: 'get'
  })
}
